// import { Module } from '@nestjs/common'
// import { AppController } from './app.controller'
// import { AppService } from './app.service'
// import { UserModule } from './user/user.module'
// import { MongooseModule } from '@nestjs/mongoose'
// import { ConfigModule } from '@nestjs/config'
// import { CommonModule } from './common/common.module'
// import { BarModule } from './bar/bar.module'
// import { PropositionModule } from './proposition/proposition.module'

// @Module({
//   imports: [
//     MongooseModule.forRoot('mongodb://localhost/blog'),
//     UserModule,

//     //全局读取环境变量
//     ConfigModule.forRoot({
//       isGlobal: true,
//     }),
//     CommonModule,
//     BarModule,
//     PropositionModule,
//   ],
//   controllers: [AppController],
//   providers: [AppService],
//   exports: [AppService],
// })
// export class AppModule {}
import { Module } from '@nestjs/common'
import { AppController } from './app.controller'
import { AppService } from './app.service'
import { UserModule } from './user/user.module'
import { MongooseModule } from '@nestjs/mongoose'
import { ConfigModule } from '@nestjs/config'
import { CommonModule } from './common/common.module'
import { BarModule } from './bar/bar.module'
import { PropositionModule } from './proposition/proposition.module'
import { WsGateway } from './WebSocket/ws.gateway'
import { Chat, chatSchema } from './model/chat.schema'
@Module({
  imports: [
    UserModule,
    MongooseModule.forRoot('mongodb://localhost/blog'),
    MongooseModule.forFeature([{ name: Chat.name, schema: chatSchema }]),
    //全局读取环境变量
    ConfigModule.forRoot({
      isGlobal: true,
    }),
    CommonModule,
    BarModule,
    PropositionModule,
  ],
  controllers: [AppController],
  providers: [AppService, WsGateway],
})
export class AppModule {}
